import 'package:calf_account/sign/logic.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class SignConfigPage extends StatelessWidget {
  const SignConfigPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("欢迎"),
      ),
      body: Container(
        decoration: const BoxDecoration(
          image: DecorationImage(
            image: AssetImage("res/bg.gif"),
            fit: BoxFit.cover,
          ),
        ),
        child: Center(
          child: Container(
            decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.circular(10.0),
                boxShadow: const [
                  BoxShadow(
                      color: Colors.black38,
                      offset: Offset(0.0, 10.0), //阴影xy轴偏移量
                      blurRadius: 10.0, //阴影模糊程度
                      spreadRadius: 1.0 //阴影扩散程度
                      )
                ]),
            width: 350,
            height: 90,
            child: Column(
              children: [
                TextField(
                  obscureText: true,
                  controller: Get.find<SignConfigLogic>().mainPassController,
                  maxLength: 36,
                  maxLines: 1,
                  decoration: InputDecoration(
                    labelText: "主密码",
                    prefixIcon: const Icon(Icons.lock),
                    suffix: GestureDetector(
                      onTap: () => {
                        Get.find<SignConfigLogic>().mainPassController.clear()
                      },
                      child: const Icon(
                        Icons.clear,
                        size: 18,
                      ),
                    ),
                  ),
                  onSubmitted: (v) => {Get.find<SignConfigLogic>().submit(v)},
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
